"use strict";
function urlObj(url) {
    const urlArr = url.split('?')[1].split('&');
    let obj = {};
    urlArr.forEach(item => {
        const keys = item.split('=')[0];
        obj = Object.assign(Object.assign({}, obj), { [keys]: item.split('=')[1] });
    });
    return obj;
}
const urlValue = urlObj(location.href);
console.log(urlValue);
Ajax(`/api/getDetail?id=${urlValue.id}`, (data) => {
    render(data.data);
});
function render(data) {
    const detailWrap = document.querySelector('.detailWrap');
    detailWrap.innerHTML = `
    <div>
        <h1>${data.title}</h1>
        <img src='${data.img}' alt>
        <p>${data.desc}</p>
        <p>${data.text}</p>    
    </div>
    `;
}
